package com.cloud.system.api.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 资源类型枚舉
 * 
 * @author taominglong
 *
 */
public enum ResourceTypeEnum {
	ITEM(1, "栏目"), MENU(2, "菜单"), TAB(3, "标签页"), BUTTON(4, "按钮"), OTHER(9, "其他");

	private static final Map<Integer, ResourceTypeEnum> enumMap = new HashMap<Integer, ResourceTypeEnum>();

	static {
		for (ResourceTypeEnum type : ResourceTypeEnum.values()) {
			enumMap.put(type.getCode(), type);
		}
	}

	private int code;
	private String name;

	private ResourceTypeEnum(int code, String name) {
		this.code = code;
		this.name = name;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static ResourceTypeEnum getResTypeEnum(Integer code) {
		return enumMap.get(code);
	}

}
